 public class pro3 {
    public static void main(String[] args) {
        int n = 20_000;
        boolean[] isPrime = new boolean[n + 1];   // 默认 false
        java.util.Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;

       
        for (int i = 2; i * i <= n; i++) {
            if (isPrime[i]) {
                for (int j = i * i; j <= n; j += i) {
                    isPrime[j] = false;
                }
            }
        }

        
        int cnt = 0;
        for (int i = 2; i <= n; i++) {
            if (isPrime[i]) {
                System.out.printf("%6d", i);   // 右对齐，占 6 字符
                if (++cnt % 5 == 0) System.out.println();
            }
        }
        if (cnt % 5 != 0) System.out.println(); // 最后一行不满 5 个时换行
    }
}